package com.web.article;

import com.bean.Article;
import com.service.ArticleService;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.sql.SQLException;
import java.util.List;

public class MaxListServlet extends HttpServlet {
    @Override
    public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doPost(req, resp);
    }

    @Override
    public void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        ArticleService service = new ArticleService();

        try {
            List<Article> maxList = service.getMaxCount();
            req.getSession().setAttribute("maxList", maxList);


        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }
    }
}